#ifndef NEBOMAIN_H
#define NEBOMAIN_H

#include <QMainWindow>
#include <QProcess>
#include <QFile>
#include <QTextStream>
namespace Ui {
class NeboMain;

}
enum MeasurementType{
    ROAM_TIME = 0,
    DATA_RATE
};

class NeboMain : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit NeboMain(QWidget *parent = 0);
    ~NeboMain();
    void initialize();
    inline void init(){

        roamCount = 0;
        roamSum = 0.0f;
        longestRoamTime = 0.0f;
        drCount = 0;
        averageDr = 0.0f;
    }
    QString getMACAddress(const MeasurementType type);
    bool filterTranslatedCap(const QString MACadd, const MeasurementType type);
    QString parseMACAddress(const QString str);
    void readAsciiFile(MeasurementType);
    QString parseAbsoluteTime(const QString str);
    void parseDataRate(const QString str);
    void setMACValidator();
    bool checkEmptyMACAddr(MeasurementType meas_type);

    inline bool renameNonCapFile();
    bool TranslateCapFile();
    bool ConvertWlanCap2AsciiFile(MeasurementType meas_type);

    inline void browseFile();
    void setAboutInfo();
public slots:
    void browseRoamCapFile();  // browse roam input file
    void browseDataRateCapFile(); // browse data rate input file
    void calculateRoamTime(); // process roam time calculation operation
    void calculateDataRate(); // process data rate calculation operation
signals:
    void MeasurementTypeSelection(MeasurementType type);
private:
    Ui::NeboMain *ui;
    QProcess *proc; // process for external commands
    QString inputCapFile;  // input capture file
    QString translatedCapFile; // the path of translated.cap file
    QString wlanFile; // the path of wlan-da.cap file
    QString dirPath;  // directory containing input, translated.cap, wlan-da.cap files
    QString asciiFile;
    QString macAddress;    // MAC address string of client
    int roamCount; // the number of roams
    float roamSum; // the sum of all roams
    float longestRoamTime; // longest roam time
    int drCount;    // number of data rates found in text file
    float averageDr;   // average data rate

};

#endif // NEBOMAIN_H
